package com.weipai.springboot.model.api;

//import com.sun.xml.internal.xsom.impl.scd.Iterators;

import java.util.*;

/**
 * @author songmengqiang
 * @create 2018-09-10 11:57
 **/

public class ItemSearchProp {

    private Map<String, List<String>> propMap = new TreeMap<>();

    public void putAll(String key, List<String> values) {
        if (key != null && values != null) {
            for (String value : values) {
                put(key, value);
            }
        }
    }

    public void putAll(Map<String, String> map) {
        if (map != null) {
            for (Map.Entry<String, String> entry : map.entrySet()) {
                put(entry.getKey(), entry.getValue());
            }
        }
    }

    public void put(String key, String value) {
        List<String> props = propMap.get(key);
        if (null == props) {
            props = new ArrayList<>();
            propMap.put(key, props);
        }
        if (!props.contains(value)) {
            props.add(value);
        }
    }

    public Map<String, List<String>> getPropMap() {
        return propMap;
    }

    public void setPropMap(Map<String, List<String>> propMap) {
        this.propMap = propMap;
    }
}
